<?php
class HandHistoryController extends AppController{
	var $name = 'HandHistory';
	var $helpers = array('Html','Javascript');
	

	function ajaxTableStatus(){
		//Configure::Write('debug',0);
		$this->layout = '';
		
		$this->HandHistory->historyFolder = './userfiles';
		$this->HandHistory->userName = $_SESSION['username'];
		$this->HandHistory->handDate = (isset($this->data['handDate'])) ? $this->data['handDate'] : $_GET['handDate'];
		$this->HandHistory->tableName = (isset($this->data['table'])) ? $this->data['table'] : $_GET['table'];

		$this->HandHistory->processHandFile();
		$handLog['hands'] = $this->HandHistory->hands;
		$handLog['tableStats'] = $this->HandHistory->tableStats;
		echo $this->HandHistory->calculateTableCssClass($handLog);
		exit();
	}
	
	function view(){
		$this->HandHistory->historyFolder = 'userfiles';
		$this->HandHistory->userName = $_SESSION['username'];
		$this->HandHistory->handDate = (isset($_REQUEST['date'])) ? $_REQUEST['date'] : date('Ymd');
		$this->HandHistory->tableName = (isset($_REQUEST['table'])) ? stripslashes($_REQUEST['table']) : '';
		$this->HandHistory->processHandFile();
		
		$this->set('stats' , $this->HandHistory->tableStats);
		$this->set('hands' , $this->HandHistory->hands);
		$this->set('userName', $this->HandHistory->userName);
		$this->set('handDate', $this->HandHistory->handDate);
	}
	
}
?>